<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:r="http://ricchieri.com/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
	<ui:composition template="../../templates/commonLayoutReports.xhtml">
		<ui:define name="title">#{msg.titleReport}</ui:define>
		<ui:define name="content">
			<h2>#{msg.reservationByOperator}</h2>
			<h:form id="reservationOperation">
				<h:panelGrid columns="2">
				    <h:outputLabel value="#{msg.tripOrientation}" />
					<p:selectOneMenu value="#{reservationOperatorMB.filter.trip}">
						<f:selectItem itemLabel="#{msg.defaultComboValue}" itemValue="" />
						<f:selectItems value="#{reservationOperatorMB.trips}" />
					</p:selectOneMenu>
					
					<h:outputLabel value="#{msg.reservationType}"/>
	       	 		<p:selectOneMenu value="#{reservationOperatorMB.filter.reservationType}">
	       	 			<f:selectItem itemLabel="#{msg.defaultComboValue}" itemValue="" />
						<f:selectItems value="#{reservationOperatorMB.reservationType}" />
					</p:selectOneMenu>
					
					<h:outputLabel value="#{msg.from}" />
					<p:calendar pattern="dd/MM/yyyy" showOn="button"
						readOnlyInputText="true"
						value="#{reservationOperatorMB.filter.start}">
						<f:convertDateTime pattern="dd/MM/yyyy" timeZone="GMT-3" />
					</p:calendar>
					
					<h:outputLabel value="#{msg.to}" />
					<p:calendar pattern="dd/MM/yyyy" showOn="button"
						readOnlyInputText="true"
						value="#{reservationOperatorMB.filter.finish}">
						<f:convertDateTime pattern="dd/MM/yyyy" timeZone="GMT-3" />
					</p:calendar>
	         	</h:panelGrid>
		        <h:panelGrid columns="2" style="margin-top:10px; text-align:center">
	     			<r:commandLinkCustom id="reset" action="#{reservationOperatorMB}" method="reset" icon="icon-eraser" message="#{msg.resetButton}" update="@form"/>
	    			<r:commandLinkCustom id="search" action="#{reservationOperatorMB}" method="search" icon="icon-search" message="#{msg.searchButton}" update="@form"/>
	     	 	</h:panelGrid>
	     	 	
	     	 	<p:dataTable var="operator" value="#{reservationOperatorMB.reservationOperator}" 
	     	 		style="padding-top:15px;padding-bottom:15px" rows="5" paginator="true" lazy="true"
	     	 		paginatorPosition="bottom" emptyMessage="#{msg.noRecordsFound}">
	     	 		
	        		<p:column headerText="#{msg.operator}" style="width:15%">  
		            	<h:outputText value="#{operator.user.fullName}" />   
	        		</p:column>
	
	       			<p:column headerText="#{msg.documentType}" style="width:7%">  
		            	<h:outputText value="#{reservationOperatorMB.obtainDescription(operator.user.documentType.description)}" />   
	        		</p:column> 
	        		
			        <p:column headerText="#{msg.documentNum}" style="width:20%">  
		            	<h:outputText value="#{operator.user.dni}" />   
	        		</p:column> 
	        		
	 		 		<p:column headerText="#{msg.reservationQuantity}" style="width:15%">  
		            	<h:outputText value="#{operator.count}" />   
	        		</p:column> 
	        		
	        		 <p:column headerText="#{msg.reservationPercentaje}" style="width:15%">  
		            	<h:outputText value="#{reservationOperatorMB.formatNumberWithoutDecimals(operator.percentaje)}" />   
	        		</p:column>
	        	</p:dataTable>
	
				<p:fieldset legend="#{msg.graphicPie}" toggleable="false" toggleSpeed="500"> 
        			<p:pieChart id="basic" value="#{reservationOperatorMB.pieModel}" style="width:100%;height:30em" showDataLabels="true" sliceMargin="1" legendPosition="nw" diameter="280"/>
        		</p:fieldset>
				<p:fieldset legend="#{msg.graphicLine}" toggleable="false" toggleSpeed="500" style="margin-top:15px">
        			<p:barChart id="linear" value="#{reservationOperatorMB.categoryModel}" style="width:100%;height:30em" showDataLabels="true" xaxisAngle="45" />
        		</p:fieldset>
		        		
	        </h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>
